package xxl.robotlegs.extensions.viewprocessormap.impl 
{
	import flash.utils.Dictionary;
	import xxl.robotlegs.framework.api.IInjector;
	/**
	 * ...
	 * @author XXL
	 */
	public class ViewInjectionProcessor 
	{
		private const _injectedObjects:Dictionary = new Dictionary(true);
		
		public function ViewInjectionProcessor() 
		{
			
		}
		
		public function process(view:Object, type:Class, injector:IInjector):void
		{
			_injectedObjects[view] || injectAndRemember(view, injector);
		}
		
		public function unprocess(view:Object, type:Class, injector:IInjector):void
		{
			//may be teardown
		}
		
		//----------private
		
		private function injectAndRemember(view:Object, injector:IInjector):void
		{
			injector.injectInto(view);
			_injectedObjects[view] = view;
		}
		
	}

}